/***
*
* File: wp_onscript.nut
* Auth: Damian Wojdat
* Date: 20.10.2012
* Desc: onScriptInit() callback.
*
*************************************************************************************************************/

function onScriptInit()
{	
	sql = mysql(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
	// sql = mysql(mysql_host, mysql_user, mysql_pass, mysql_db);
	
	loadVehModelsData();
	loadVehicles();
	// loadBuildings();
	loadFactions();
	loadDefaultSpawnData();
	
	setTrafficLightsPhaseDuration( 1, 4000);
	setTrafficLightsPhaseDuration( 2, 2000);
	setTrafficLightsPhaseDuration( 3, 4000);
	log("[INFO:] Street lights cycle changed");
	
	local time = date();
	setTime(time["hour"], time["min"]);
	setDayOfWeek(time["wday"]);
	setMinuteDuration(15000);
	log("[INFO:] Time set and speed of time changed");	
	
	timer(halfSecTimer, 500, -1);
	timer(oneSecTimer, 1000, -1);
	timer(oneMinTimer, 60000, -1);
	timer(tenMinTimer, 600000, -1);
	log("[INFO:] Timers started");	
	
	/*
	* Random round
	*/
	selectRandomRound();
	
	log("[INFO:] All functions initialized");
	log("[INFO:] Version: " + _version_ + "\n\n");
	return 1;
}
addEvent("scriptInit", onScriptInit);

function onScriptExit()
{
	return 1;
}
addEvent("scriptExit", onScriptExit);